﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

namespace WebSite.cn
{
    public partial class InstitutionCardList : System.Web.UI.Page
    {
        int InstitutionID
        {
            get
            {
                return int.Parse(this.Request.QueryString["id"]);
            }
        }

        string _titleName = string.Empty;

        public string TitleName
        {
            get { return _titleName; }
            set { _titleName = value; }
        }
        string _htmlContent = string.Empty;

        public string HtmlContent
        {
            get { return _htmlContent; }
            set { _htmlContent = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            int num4 = Convert.ToInt32(info.info1("", "homeshowpnum2"));
            StringBuilder sbContent = new StringBuilder();
          DataTable   table = SQLAccess.GreatDs("select top " + num4 + " proid,proname,proprice1,proprice3,propic2,typeid from DB_Shoppro where visible=1 and proisshow=1 and isnull(institutionId,0)=" + InstitutionID.ToString() +" and proisnew3=1 and isnull(proku1,0)>0 order by proorder").Tables[0];
            if (table.Rows.Count > 0)
            {
                int num8 = 0;
                sbContent.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table_card\" ><tr>");
                foreach (DataRow row4 in table.Rows)
                {
                    sbContent.Append("    <td valign='top'>");
                    sbContent.Append("<p><a href='products_details.aspx?pid=" + row4["proid"].ToString() + "&sid=3'><img src=../uploadfile/product/" + row4["propic2"].ToString() + " width='110px'  /></a></p>");
                    sbContent.Append("<ul>");
                    sbContent.Append( "<li style='height:36px'><a href='products_details.aspx?pid=" + row4["proid"].ToString() + "&sid=3' title='" + row4["proname"].ToString() + "'>" + fun.Left(row4["proname"].ToString(), 15) + "</a></li>");

                    sbContent.Append("<li style='height:18px' class='text_red'>零售价:" + string.Format("{0:f}", row4["proprice1"]) + "</li>");
                    //    this._htmlContent = this._htmlContent + "<li class='text03'>市场价:" + string.Format("{0:f}", row4["proprice3"]) + "</li>";

                    sbContent.Append("</ul>");
                    sbContent.Append( "</td>");
                    num8++;
                    if (num8 >= table.Rows.Count)
                    {
                        break;
                    }
                    if ((num8 % 5) == 0)
                    {
                        sbContent.Append("</tr><tr>");
                    }
                }
                sbContent.Append("</tr><table>");
            }
            _htmlContent = sbContent.ToString();
        }
    }
}